<?php
    /**
    * Email : mr.linhtx88@gmail.com   
    * Phone : +84919.021.508
    * 
    * History       :
    *   Date        : 15-Apr-2012
    *   Modified by : mr.linhtx88@gmail.com        
    *   Purpose     : create class dalStory, function getLatestStory
    *  
    *   Date        : 16-Apr-2012
    *   Modified by : mr.linhtx88@gmail.com        
    *   Purpose     : create function: getTopStory_1, getTopStory_2, getTopStory_3
    */

    include_once('./Library/DataProvider/config/connectDB.php');     

    class dalStory{  

        /*
        *  @get lastest Story in forum Truy?n-Tho Van  
        * 
        *  @input   : $query from 'stco.vn\Module\Story\bllStory.php' function getLatestStory
        *  @output  ; contect of lastest Story           
        */ 
        public function getLatestStory($query){
            connectDB::connDB_VBB(); // connect DB of Forum STCO          
            $intro = '';  
            $result = mysql_query($query);  
            if(!$result){
                $intro = mysql_error();
            } else {
                while($row = mysql_fetch_row($result)){
                    $intro = $row[0];     
                }         
            }  
            // return
            return $intro;         
        }          

        /*
        *  @get lastest top 1 Story in forum Truy?n-Tho Van  
        * 
        *  @input   : $query from 'stco.vn\Module\Story\bllStory.php' function getTopStory_1
        *  @output  ; contect of lastest Story Top 1          
        */ 
        public function getTopStory_1($query){
            connectDB::connDB_VBB(); // connect DB of Forum STCO          
            $intro = '';  
            mysql_query("SET NAMES 'utf8'"); 
            $result = mysql_query($query);             
            if(!$result){
                $intro = mysql_error();
            } else {
                while($row = mysql_fetch_row($result)){
                    $intro = array($row[0],$row[1],$row[2]);   
                }         
            }  
            // return
            return $intro;         
        }     

        /*
        *  @get lastest top 2 Story in forum Truy?n-Tho Van  
        * 
        *  @input   : $query from 'stco.vn\Module\Story\bllStory.php' function getTopStory_2
        *  @output  ; contect of lastest Story Top 2          
        */ 
        public function getTopStory_2($query){
            connectDB::connDB_VBB(); // connect DB of Forum STCO          
            $intro = '';  
            mysql_query("SET NAMES 'utf8'"); 
            $result = mysql_query($query);             
            if(!$result){
                $intro = mysql_error();
            } else {
                while($row = mysql_fetch_row($result)){
                    $intro = array($row[0],$row[1],$row[2]);
                }         
            }  
            // return
            return $intro;         
        }          

        /*
        *  @get lastest top 3 Story in forum Truyen-Tho Van  
        * 
        *  @input   : $query from 'stco.vn\Module\Story\bllStory.php' function getTopStory_3
        *  @output  ; contect of lastest Story Top 3          
        */ 
        public function getTopStory_3($query){
            connectDB::connDB_VBB(); // connect DB of Forum STCO          
            $intro = '';  
            mysql_query("SET NAMES 'utf8'"); 
            $result = mysql_query($query);             
            if(!$result){
                $intro = mysql_error();
            } else {
                while($row = mysql_fetch_row($result)){
                    $intro = array($row[0],$row[1],$row[2]);   
                }         
            }  
            // return
            return $intro;         
        }               
    }   
?>
